package com.example.medicalretrieval.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import com.example.medicalretrieval.pojo.BrowsingHistory;

import java.util.Date;
import java.util.List;

@Dao
public interface BrowsingHistoryDao {
    @Insert
    void insert(BrowsingHistory browsingHistory);

    @Delete
    void delete(BrowsingHistory browsingHistory);
    @Query("select * from browsinghistory order by 0+date DESC")
    List<BrowsingHistory> queryByTimeOfDESC();

    @Query("update browsinghistory set date = :date where title = :title")
    void updateByTitle(String title , Date date);

    @Query("delete from browsinghistory where title=:title")
    void deleteByTitle(String title);

}
